library(tidyverse)
library(cowplot)
library(broom)
library(pwr)
library(plotly)
setwd("~/GitHub/time-course/data")
#setwd("~/Library/Mobile\ Documents/com~apple~CloudDocs/time-course/data")
rawdata <- "revised_MASTER-ExperimentSummary.csv"
timecourse <- "timecourse2017.csv"
standards <- "standards_MASTER-ExperimentSummary.csv"
data <- read_csv(rawdata)
tc <- read_csv(timecourse, na = c("","NA"))
std <- read_csv(standards)
data1 <- data %>%
gather(Sample,Count,2:250)
# Separate samples by identifiers
data2 <- data1 %>%
separate(Sample, into=c("Sample_ID","Dilution_factor","Injection","Tech_rep", sep = "_")) %>%
select(-`_`)
std1 <- std %>%
gather(Sample,Count,2:82)
std2 <- std1 %>%
separate(Sample, into=c("Sample_ID","When","Dilution_factor","Nano_day","Injection","Tech_Rep", sep = "_")) %>%
select(-`_`)
std2$Sample_ID <- as.factor(std2$Sample_ID)
std2$When <- as.factor(std2$When)
std2$Dilution_factor <- as.numeric(std2$Dilution_factor)
std2$Injection<- as.factor(std2$Injection)
std2$Nano_day <- as.numeric(std2$Nano_day)
std2 <- std2 %>%
mutate(True_Count=Dilution_factor*Count)
std2$Nano_day <- factor(std2$Nano_day, levels=c('1','2','3','4','5','6','7'))
std2$When <- factor(std2$When, levels=c('before','after'))
std3 <- std2 %>%
group_by(particle_size,Sample_ID,When,Dilution_factor,Nano_day,Injection) %>%
summarise( tech_N = length(True_Count),
tech_mean = mean(True_Count),
tech_sd = sd(True_Count),
tech_se = tech_sd/sqrt(tech_N))
std3
std4 <- std3 %>%
group_by(Nano_day,When,particle_size) %>%
summarise( inj_N = length(tech_mean),
inj_mean = mean(tech_mean),
inj_sd = sd(tech_mean),
inj_se = inj_sd/sqrt(inj_N))
std4
std_day <- std4 %>%
ggplot(aes(x=particle_size,y=inj_mean,color=When))+
geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Condition")+ #Label table title
facet_grid(. ~ Nano_day)
std_day
###Plot facet by when and experimental day
std_day_facet <- std4 %>%
ggplot(aes(x=particle_size,y=inj_mean,color=When))+
geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Condition")+ #Label table title
facet_grid(When ~ Nano_day)
std_day_facet
## Warning: Removed 1000 rows containing missing values (geom_path).
std_df <- std4 %>%
group_by(Nano_day,When) %>%
summarise(total=sum(inj_mean))
std_df
std_df %>%
ggplot(aes(x=Nano_day,y=total,fill=When))+
geom_col(position="dodge")+
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Experimental Day") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="When") #Label table title
###Intraassay variability
Intra.assay_cv <- std_df %>%
group_by(Nano_day) %>%
summarise(Day_N = length(total),
Day_mean = mean(total),
Day_sd = sd(total),
Day_se = Day_sd/sqrt(Day_N),
Day_cv = Day_sd/Day_mean )
Intra.assay_cv
Inter.assay <- Intra.assay_cv %>%
summarise(Exp_N = length(Day_mean),
Exp_mean = mean(Day_mean),
Exp_sd = sd(Day_mean),
Exp_se = Exp_sd/sqrt(Exp_N),
Exp_cv = Exp_sd/Exp_mean )
Inter.assay
# Refactoring Columns for samples
data2$Sample_ID <- as.factor(data2$Sample_ID)
data2$Dilution_factor <- as.numeric(data2$Dilution_factor)
data2$Injection<- as.factor(data2$Injection)
data2$Tech_rep <- as.numeric(data2$Tech_rep)
# Refactoring COlumns for timecourse
tc$Sample_ID <- as.factor(tc$Sample_ID)
tc$Day <- as.factor(tc$Day)
tc$Weight <- as.numeric(tc$Weight)
tc$TEI_Day <- as.factor(tc$TEI_Day)
tc1 <- tc %>%
select(Day:Pups)
tc1
data2 <- data2 %>%
mutate(True_Count=Dilution_factor*Count)
data2
data3 <- data2 %>%
group_by(particle_size,Sample_ID,Dilution_factor,Injection) %>%
summarise( tech_N = length(True_Count),
tech_mean = mean(True_Count),
tech_sd = sd(True_Count),
tech_se = tech_sd/sqrt(tech_N))
data3
test1 <- left_join(tc1,data3, by= "Sample_ID")
data4 <- data3 %>%
group_by(particle_size,Sample_ID,Dilution_factor) %>%
summarise( inj_N = length(tech_mean),
inj_mean = mean(tech_mean),
inj_sd = sd(tech_mean),
inj_se = inj_sd/sqrt(inj_N))
data4
test2 <- left_join(tc1,data4, by= "Sample_ID")
test2
test1$Sample_ID_correct = factor(test1$Sample_ID, levels=c('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','70','73','74','75'))
graph1 <- test1 %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct, nrow=7)
graph1
Virgin Mice
test1 %>%
filter(Day == '1') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
GD 5.5
test1 %>%
filter(Day == '5') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
GD 10.5
test1 %>%
filter(Day == '10') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
GD 14.5
test1 %>%
filter(Day == '14') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
GD 17.5
test1 %>%
filter(Day == '17') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
1 Day Post
test1 %>%
filter(Day == '20') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
graph2 <- test2 %>%
group_by(TEI_Day) %>%
ggplot(aes(x=particle_size, y=inj_mean,color=Day ))+ #plot
#geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Condition")+ #Label table title
facet_wrap(~ TEI_Day, ncol=7)
graph2
### Particle concentration values for each of the 36 samples
test3 <- test2 %>%
group_by(Day,Sample_ID) %>%
summarise(particle_conc=sum(inj_mean))
test3
test4 <- test3 %>%
group_by(Day) %>%
summarise(Day_N=length(particle_conc),
Day_mean = mean(particle_conc),
Day_sd = sd(particle_conc),
Day_se = Day_sd/sqrt(Day_N))
test4
plot1 <- test3 %>%
filter(!Sample_ID %in% c('6','28','32')) %>%
group_by(Day) %>%
ggplot(aes(x= Day, y = (particle_conc)/1E9), color=Day) +
geom_boxplot(colour="black",fill=NA) +
geom_point(aes(text = paste("Sample ID:", Sample_ID)),
position='jitter',size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition")+ # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
plot1
#ggsave("Exosome_plot.png", height = 5, width = 7, units = "in", dpi = 600)
ggplotly(plot1)
plot <- test4 %>%
ggplot(aes(x=Day, y=Day_mean, fill=Day ))+ #plot
geom_col()+
geom_errorbar(aes(ymin=Day_mean-Day_se, ymax=Day_mean+Day_se), width=.5,
size=0.8, colour="black", position=position_dodge(.9)) + #error bars
scale_y_continuous(expand=c(0,0), breaks = seq(1E11,4E11,1E11))+ #set bottom of graph and scale
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(fill="Condition") + # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post"))
plot
ggsave("Exosome_barplot.png", height = 5, width = 7, units = "in", dpi = 600)
test7 <- test3 %>%
left_join(tc1)
## Joining, by = c("Day", "Sample_ID")
plot2 <- test7 %>%
ggplot(aes(x = Day, y = particle_conc, color = Day, shape=TEI_Day))+
geom_point(position= 'dodge',size=4)+
scale_shape_manual(values=c(15,16,17,18,22,23,24))+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition") + # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post"))
plot2
ggplotly(plot2)
## Warning: Width not defined. Set with `position_dodge(width = ?)`
nano_100 <- data4 %>%
filter(particle_size<140.5)
nano_100_data <- left_join(tc1,nano_100, by= "Sample_ID")
nano_100_data_plot <- nano_100_data %>%
group_by(Day,Sample_ID) %>%
summarise(particle_conc=sum(inj_mean)) %>%
filter(!Sample_ID %in% c('6','28','32')) %>%
ggplot(aes(factor(Day),particle_conc, color=Day)) +
geom_boxplot(colour="black",fill=NA) +
geom_point(position='jitter',size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition") + # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post"))
nano_100_data_plot
tidy(shapiro.test(test3$particle_conc))
p value >0.05 therefore conclude data is normally distributed
jacob <- nano_100_data %>%
group_by(Day,Sample_ID) %>%
summarise(particle_conc=sum(inj_mean)) %>%
filter(!Sample_ID %in% c('6','28','32'))
fit <- aov(particle_conc ~ Day, data=jacob)
stats <- tidy(fit)
stats
Statistically significant, thus Tukey’s HSD post hoc analysis can determine significant differences.
HSD <- TukeyHSD(fit)
tukey <- tidy(HSD)
tukey
tukey %>%
filter(adj.p.value<0.05) %>%
arrange(adj.p.value)
test8 <- test7 %>%
filter(!Day == "20")
fit <- lm(particle_conc ~ Weight ,data = test8)
summary(fit)
##
## Call:
## lm(formula = particle_conc ~ Weight, data = test8)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.600e+11 -7.122e+10 -2.456e+10 8.690e+10 2.239e+11
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.768e+10 7.666e+10 0.752 0.45727
## Weight 8.548e+09 2.849e+09 3.000 0.00519 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.127e+11 on 32 degrees of freedom
## Multiple R-squared: 0.2196, Adjusted R-squared: 0.1952
## F-statistic: 9.002 on 1 and 32 DF, p-value: 0.00519
tidy(summary(fit))
test7 %>%
ggplot(aes(x= Weight, y = particle_conc))+
geom_point()+
geom_smooth()+
xlab("\nWeight (g)\n") + # X axis label
ylab("Exosomes/ml\n") + # Y axis label
ggtitle("Linear Regression of Exosome \nConcentration vs. Weight")+ #title
labs(color="Day")#Label table title
## `geom_smooth()` using method = 'loess'
test7 %>%
filter(!Sample_ID == '70') %>%
ggplot(aes(x= Weight, y = particle_conc))+
geom_point(size = 3,aes(color=factor(Day)))+
geom_smooth(method = "lm", level = 0.95)+
xlab("\nWeight (g)\n") + # X axis label
ylab("Exosomes/ml\n") + # Y axis label
ggtitle("Linear Regression of Exosome \nConcentration vs. Weight")+ #title
labs(color="Day")#Label table title
test7 %>%
ggplot(aes(x= Pups, y = particle_conc))+
geom_point(size = 4, aes(color=factor(Day)))+
#geom_smooth(method = "lm", level = 0.95)+
scale_x_continuous(breaks=seq(0,12,2))+
xlab("\nNumbwe of Pups\n") + # X axis label
ylab("Exosomes/ml\n") + # Y axis label
ggtitle("Linear Regression of Exosome \nConcentration vs. Number of Pups")+ #title
labs(color="Day")#Label table title
mean_placenta <- tc %>%
filter(Day %in% c('10','14','17') & !Sample_ID %in% c('70','73','74','75')) %>%
select(-(TEI_Day:Pup_right),-Resorp) %>%
gather("Placenta_avg","Plac_weight", 3:5) %>%
group_by(Day,Sample_ID) %>%
summarise(N = length(Plac_weight),
mean_plac = mean(Plac_weight*1000, na.rm = TRUE), #convert g to mg
sd = sd(Plac_weight)*1000, #convert g to mg
se = sd/sqrt(N))
mean_placenta %>%
inner_join(test7) %>%
ggplot(aes(x= mean_plac, y = particle_conc))+
geom_point(size= 3,aes(color=factor(Day)))+
geom_smooth(method = "lm", level = 0.95)+
xlab("\nPlacental Weight (mg)\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="G.D.")#Label table title
## Joining, by = c("Day", "Sample_ID")
## Warning in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factor and character vector, coercing into character vector
mean_placenta %>%
inner_join(test7) %>%
ggplot(aes(x = Pups, y = particle_conc))+
geom_point(size= 3,aes(color=factor(Day)))+
geom_smooth(method = "lm", se= FALSE)+
facet_wrap(~Day)+
scale_x_continuous(breaks=seq(1,12,2))+
xlab("\nNumbr of Pups\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="G.D.")#Label table title
## Joining, by = c("Day", "Sample_ID")
## Warning in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factor and character vector, coercing into character vector
test3 %>%
filter(!Day %in% c('1','20')) %>%
group_by(Day) %>%
ggplot(aes(factor(Day),particle_conc, color=Day)) +
geom_point(size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition")#Label table title
nanosight_plot <- test1 %>%
filter(Sample_ID == '75') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se, ymax=tech_mean+tech_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size (nm)") + # X axis label
ylab("\nMean Particle Concentration/ml\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~Injection)
nanosight_plot
## Warning: Removed 1000 rows containing missing values (geom_path).
ggsave("Nanosight_plot.png", height = 5, width = 7, units = "in", dpi = 600)
## Warning: Removed 1000 rows containing missing values (geom_path).
test3 %>%
filter(!Sample_ID %in% c('1','6','15','16','19','24','29','6','28','32')) %>%
group_by(Day) %>%
ggplot(aes(x= Day, y = particle_conc, color=Day)) +
geom_boxplot(colour="black",fill=NA) +
geom_point(aes(text = paste("Sample ID:", Sample_ID)),
position='jitter',size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition")+ # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
## Warning: Ignoring unknown aesthetics: text
filtered_data <- test3 %>%
filter(!Sample_ID %in% c('1','6','15','16','19','24','29','6','28','32'))
filtered_fit <- aov(particle_conc ~ Day, data=filtered_data)
filtered_stats <- tidy(filtered_fit)
filtered_stats
filtered_HSD <- TukeyHSD(filtered_fit)
filtered_tukey <- tidy(filtered_HSD)
filtered_tukey %>%
filter(adj.p.value < 0.05) %>%
arrange(adj.p.value)
mean_placenta %>%
group_by(Day) %>%
summarise(mean_N = length(mean_plac),
day_mean = mean(mean_plac),
day_sd = sd(mean_plac),
day_se = day_sd/sqrt(mean_N)) %>%
ggplot(aes(x = Day, y = day_mean, fill = Day))+
geom_bar(stat="identity")+
geom_errorbar(aes(ymin = day_mean-day_se, ymax = day_mean+day_se), width=.5,
size=0.8, colour="black", position=position_dodge(.9)) + #error bars
scale_y_continuous(breaks = seq(0,125,25),
limits = c(0,125),
expand = c(0,0))+ #set bottom of graph and scale
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nWeight (mg)\n") + # Y axis label
ggtitle("Mouse Placental Weight\nThroughout Pregnancy\n")+ #title
labs(fill="Gestational Day") # Label table title